<template>
    <view class="container">
        <c-navBar title="系统设置" isPerch></c-navBar>
        <view class="content">

            <view class="item" @click="jumpPage('用户协议')">
                <text class="item-text">用户协议</text>
                <image class="img" src="/static/home/right1.png" mode="scaleToFill" />
            </view>
            <view class="item" @click="jumpPage('隐私协议')">
                <text class="item-text">隐私协议</text>
                <image class="img" src="/static/home/right1.png" mode="scaleToFill" />
            </view>
            <view class="item" @click="jumpPage('修改密码')">
                <text class="item-text">修改密码</text>
                <image class="img" src="/static/home/right1.png" mode="scaleToFill" />
            </view>
            <view class="item" @click="jumpPage('退出登录')">
                <text class="item-text">退出登录</text>
                <image class="img" src="/static/home/right1.png" mode="scaleToFill" />
            </view>
        </view>
    </view>
</template>

<script>
export default {
    data() {
        return {
            height: this.$titleHeight
        };
    },
    methods: {
        jumpPage(type) {
            switch (type) {
                case '用户协议':
                    uni.navigateTo({
                        url: `/pages/login/agreement?type=${1}`,
                    });
                    break;
                case '隐私协议':
                    uni.navigateTo({
                        url: `/pages/login/agreement?type=${2}`,
                    });
                    break;
                case '修改密码':
                    uni.navigateTo({
                        url: '/pages/home/changePassword'
                    })
                    break
                case '退出登录':
                    uni.showModal({
                        title: '提示',
                        content: '确定要退出登录吗？',
                        confirmColor: '#00693A',
                        success: (res) => {
                            if (res.confirm) {

                                uni.removeStorageSync('token')
                                uni.removeStorageSync('role')

                                uni.reLaunch({
                                    url: '/pages/tabbar/login'
                                })
                            }
                        }
                    })
            }
        }
    },
    mounted() { },
};

</script>

<style scoped lang="scss">
.container {

    .content {

        .item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin: 0 32rpx;
            height: 100rpx;
            border-bottom: 1rpx solid #E6E6E6;

            .item-text {
                font-size: 32rpx;
                color: #333333;
            }

            .img {
                width: 24rpx;
                height: 24rpx;
            }
        }
    }
}
</style>